package com.devunion.salon.client.app.mvc.controller;

import com.devunion.salon.client.app.mvc.SalonEvents;
import com.devunion.salon.client.app.mvc.view.CompanyView;
import com.extjs.gxt.ui.client.mvc.AppEvent;
import com.extjs.gxt.ui.client.mvc.Controller;

/**
 * @author Timoshenko Alexander 27.02.2009 : 13:18:15
 */
public class CompanyController extends Controller {
    public static final String COMPANY_CONTROLLER_ID="COMPANY_CONTROLLER_ID";
    private CompanyView view;

    public CompanyController() {
        registerEventTypes(SalonEvents.COMPONENT_INIT);
    }

    protected void initialize() {
        view = new CompanyView(this);
    }

    public void handleEvent(AppEvent<?> event) {
        if (event.data instanceof String) {
            String iComponentID = (String) event.data;
            if (iComponentID!=null && iComponentID.equals(COMPANY_CONTROLLER_ID)) {
                forwardToView(view, event);
            }
        }
    }
}
